package com.qjdchina.sku.biz.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.qjdchina.commons.result.Result;
import com.qjdchina.sku.biz.RolePriceManager;
import com.qjdchina.sku.dao.mapper.RolePriceMapper;
import com.qjdchina.sku.model.RolePrice;
import com.qjdchina.sku.service.enums.SkuResultCode;

/**
 * 角色价格关联
 * @author shenpingfeng
 * 2016年12月12日
 */
@Service
public class RolePriceManagerImpl implements RolePriceManager {

	private static final Logger LOGGER = LoggerFactory.getLogger(RolePriceManagerImpl.class);

	@Autowired
	private RolePriceMapper rolePriceMapper;
	

	/**
	 * 根据skuRoleId获取
	 * shenpingfeng
	 * 2016年12月12日
	 * @param skuRoleId
	 * @return
	 */
	@Override
	public Result<RolePrice> getRolePriceBySkuRoleId(Integer skuRoleId) {
		if(skuRoleId == null){
			return new Result<RolePrice>(SkuResultCode.PARAMETER_NOT_EMPTY);
		}
		RolePrice rolePrice = rolePriceMapper.selectBySkuRoleId(skuRoleId);
		if(rolePrice == null){
			return new Result<RolePrice>(SkuResultCode.DATA_NOT_EXIST);
		}
		
		return new Result<RolePrice>(rolePrice);
	}


	

}
